﻿using System;
using System.Linq;

class Program
{
    static int HexadecimalToDecimal(string number)
    {
        return Convert.ToInt32(number, 16);
    }

    static void Main()
    {
        string number = Console.ReadLine();
        Console.WriteLine(HexadecimalToDecimal(number));
    }
}
